package com.cyh.pangu.offer;

public class Offer56 {

    public int[] singleNumbers(int[] nums) {
        int medNum = 0 ;
        for (int num : nums) {
            medNum = medNum ^ num;
        }

        int mask = 1;

        while ((medNum & mask) == 0) {
            mask = (mask << 1);
        }

        int a = 0;
        int b = 0;
        for (int num : nums) {
            if ((num & mask) == 0) {
                a = a^num;
            } else {
                b = b^num;
            }
        }
        return new int[]{a,b};

    }

    public static void main(String[] args) {

    }
}
